= form_tag '', :method => :get do
  .row
    .col-6
      = text_field_tag :q, params[:q], placeholder: placeholder
    .col-3.status-select-wrapper
      .status-select-button
        = listing_search_status_titles

      .status-select-dropdown
        .status-select-line.reset{data: {status: 'all'}}
          = listing_search_status_titles
        - @presenter.statuses.each do |status|
          - checked = params[:status].present? && params[:status].include?(status)
          .status-select-line{class: checked ? 'selected' : '', data: {status: status}}
            = check_box_tag "status[]", status, checked, id: "status-#{status}"
            = t("admin.communities.listings.status.#{status}")
    .col-3
      = submit_tag t("admin.communities.listings.search"), class: 'button search-button'
      = link_to t("admin.communities.listings.reset_search"), @presenter.reset_search_path

%span#admin_listings_count= page_entries_info(@presenter.listings, :model => "Listing").html_safe

- if @presenter.show_listings_export?
  #export-as-csv.right= link_to(" " + t("admin.communities.listings.export_all_as_csv"), {action: :export}, {remote: true, class: icon_class("download")})

%table#admin_listings
  %thead
    %tr
      %th= t("admin.communities.listings.headers.title")
      - if @presenter.admin_mode
        %th= t("admin.communities.listings.headers.author")
      %th
        = render partial: "layouts/sort_link", locals: { column: "started",
          direction: sort_link_direction("started"),
          title: t("admin.communities.listings.headers.created") }
      %th
        = render partial: "layouts/sort_link", locals: { column: "updated",
          direction: sort_link_direction("updated"),
          title: t("admin.communities.listings.headers.updated") }
      %th= t("admin.communities.listings.headers.category")
      %th= t("admin.communities.listings.headers.status")
      %th

  %tbody
    - @presenter.listings.each do |listing|
      = render 'admin/community_listings/listing', presenter: @presenter, listing: listing
.row
  .col-12
    = will_paginate @presenter.listings

= render layout: "layouts/lightbox", locals: { id: "listing_popup"} do
  #listing-form

- content_for :extra_javascript do
  = js_t ["admin.communities.listings.status.all", "admin.communities.listings.status.selected_js"], true
  :javascript
    window.ST.Listings.init();
